package com.example.demo.dao;

import com.example.demo.entity.SysShop;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface SysShopMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_shop
     *
     * @mbg.generated
     */
    @Delete({
        "delete from sys_shop",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_shop
     *
     * @mbg.generated
     */
    @Insert({
        "insert into sys_shop (`name`, info, ",
        "averager_star, location_text, ",
        "longitude, shop_image, ",
        "del_status)",
        "values (#{name,jdbcType=VARCHAR}, #{info,jdbcType=VARCHAR}, ",
        "#{averagerStar,jdbcType=DECIMAL}, #{locationText,jdbcType=VARCHAR}, ",
        "#{longitude,jdbcType=DECIMAL}, #{shopImage,jdbcType=DECIMAL}, ",
        "#{delStatus,jdbcType=BIT})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(SysShop record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_shop
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, `name`, info, averager_star, location_text, longitude, shop_image, del_status",
        "from sys_shop",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="info", property="info", jdbcType=JdbcType.VARCHAR),
        @Result(column="averager_star", property="averagerStar", jdbcType=JdbcType.DECIMAL),
        @Result(column="location_text", property="locationText", jdbcType=JdbcType.VARCHAR),
        @Result(column="longitude", property="longitude", jdbcType=JdbcType.DECIMAL),
        @Result(column="shop_image", property="shopImage", jdbcType=JdbcType.DECIMAL),
        @Result(column="del_status", property="delStatus", jdbcType=JdbcType.BIT)
    })
    SysShop selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_shop
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, `name`, info, averager_star, location_text, longitude, shop_image, del_status",
        "from sys_shop"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="info", property="info", jdbcType=JdbcType.VARCHAR),
        @Result(column="averager_star", property="averagerStar", jdbcType=JdbcType.DECIMAL),
        @Result(column="location_text", property="locationText", jdbcType=JdbcType.VARCHAR),
        @Result(column="longitude", property="longitude", jdbcType=JdbcType.DECIMAL),
        @Result(column="shop_image", property="shopImage", jdbcType=JdbcType.DECIMAL),
        @Result(column="del_status", property="delStatus", jdbcType=JdbcType.BIT)
    })
    List<SysShop> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_shop
     *
     * @mbg.generated
     */
    @Update({
        "update sys_shop",
        "set `name` = #{name,jdbcType=VARCHAR},",
          "info = #{info,jdbcType=VARCHAR},",
          "averager_star = #{averagerStar,jdbcType=DECIMAL},",
          "location_text = #{locationText,jdbcType=VARCHAR},",
          "longitude = #{longitude,jdbcType=DECIMAL},",
          "shop_image = #{shopImage,jdbcType=DECIMAL},",
          "del_status = #{delStatus,jdbcType=BIT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysShop record);
}